ruby:
  form_url = params[:action] == 'new' ? app_scheme_channels_path(@scheme.app, @scheme) : app_scheme_channel_path(@app, @scheme, @channel)

.col-md-12
  .card
    .card-header
      h3.card-title
        = @title
      .card-tools
        a href="#{app_path(@scheme.app)}"
          i.far.fa-list-alt
          |  返回应用
    .card-body
      = simple_form_for(@channel, url: form_url) do |f|
        = f.error_notification

        = f.input :scheme_id, as: :hidden, input_html: { value: params[:scheme_id] }
        = f.input :name, required: true
        = f.input :device_type, collection: Channel.device_types, label_method: :last, value_method: :first, selected: @channel.device_type ? @channel.device_type : Channel.device_types.first
        = f.input :bundle_id
        = f.input :git_url
        = f.input :slug
        = f.input :password, input_html: { type: 'input', value: @channel.password }
        - if params[:action] != 'new'
          = f.input :key, input_html: { disabled: true }
        = f.button :submit